<%@ page language="java" pageEncoding="UTF-8" buffer="16kb"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<%@ include file="/module/js.jsp"%>
<script>
	$(document)
			.ready(
					function() {
						var _form = $("#semesterForm").validate();
						//返回
						$('#btnBack').click(function() {
							document.semesterForm.action = "${basePath}/semesterSummary/semesterSummaryManagerIndex";
							document.semesterForm.submit();
										
					  });
						//返回
						$('#btnBack2').click(function() {
							document.semesterForm.action = "${basePath}/semesterSummary/semesterSummaryManagerIndex";
							document.semesterForm.submit();
										
					  });
						
						//保存
						$("#btnSave")
								.click(
										function() {
											if (_form.form()) {
												if (validateSqxm()) {
													$("#btnSave").attr(
															"disabled",
															"disabled");
													document.semesterForm.action = "${basePath}/semesterSummary/modiftyManagerSemesterSummary";
													document.semesterForm.submit();
												}
											}
										});
						  //选择
						$("#div1").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择学生',
							autoOpen : false,
						    buttons : {
						    '取消' : function() {
						    	$(this).dialog('close');
							},
							'确定' : function() {
							  if($("#fromSelect").val()==null||$("#fromSelect").val()==""){
								 layer.alert("必须选择一项", {icon: 6});
								 return false;
							  }else{
							    var formSelect = document.getElementById("fromSelect");
							    var str = [];
							    var num=0;
							    for(i=0;i<formSelect.length;i++){
							        if(formSelect.options[i].selected){
							            //str.push(select[i].value);
							            num++;
							        }
							    }
							    if(num>=2){
							     layer.alert("只能选择一项", {icon: 6});
							      return false;
							    }else{
							    	var result = $.parseJSON('${studentListJson}');
							    	var xsid=$("#fromSelect").val();
									for (var i = 0; i < result.length; i++) {
										if(xsid==result[i].xsid){
										 $("#xh").val(result[i].xh);
										 $("#xm").val(result[i].xm);
										 $("#xb").val(result[i].xb);
										 $("#bjmc").val(result[i].bjmc);
										 $("#zymc").val(result[i].zymc);
										 $("#njmc").val(result[i].njmc);
										 $("#stuid").val(xsid);
										 $("#bjid").val(result[i].bjid);
										 compareListValue(document.getElementById('zzmm'),result[i].zzmm);
										 //$("#name").val($("#fromSelect").find("option:selected").text());
										 // $("#principal").val($("#fromSelect").val());
										 break;
										}
									}
									  $(this).dialog('close');
							    }
							  }							  
							}
						  }
						});
						
					});
	function validateSqxm() {
		var p1 = $('input[name="p"]:checked').val();
		var p21 = $('input[name="p21"]:checked').val();
		var p22 = $('input[name="p22"]:checked').val();
		var bool = false;
		if (p1 != null && p1 != "") {
			bool = true;
		}
		if (p21 != null && p21 != "") {
			bool = true;
		}
		if (p22 != null && p22 != "") {
			bool = true;
		}
		if (bool == false) {
			layer.alert("本学期您想申请的先进项目至少选一项", {
				icon : 6
			});
			return false;
		}
		return bool;
	}
	  function showStudentDiv(){
	    	$('#div1').dialog('open');	
	    }
	 
	   	function optionRadion(){
			  var old = null; //用来保存原来的对象
			    $("input[name='p']").each(function(){//循环绑定事件
			        if(this.checked){
			            old = this; //如果当前对象选中，保存该对象
			        }
			        this.onclick = function(){
			            if(this == old){//如果点击的对象原来是选中的，取消选中
			                this.checked = false;
			                old = null;
			            } else{
			                old = this;
			            }
			        }
			    });
		}
</script>
</head>
<body onload="javascript:viewOrEdit();">
	<form action="#" id="semesterForm" name="semesterForm">
		 <input
			type="hidden" id="zjid" name="zjid" value="${semesterSummary.zjid}" />
		<input  type="hidden" id="ismanager" name="ismanager" value="${ismanager}"/>
		<input type="hidden" id="bzr" name="bzr" value="${ismanager}" />
		 <input type="hidden" id="gid"
			name="gid" value="${semesterSummary.gid}" />
		<div id="view">
			<table cellpadding="0" cellspacing="0" border="0"
				class="table-border" width="95%">
				<tr>
					<td class="table-header" colspan="6">期末总结信息</td>
				</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">姓名：</td>
					<td class="table-contentTD" style="width: 22%">${student.xm}</td>
					<td class="table-titleTD" style="width: 12%">学号：</td>
					<td class="table-contentTD" style="width: 22%">${student.xh}</td>
					<td class="table-titleTD" style="width: 12%">性别：</td>
					<td class="table-contentTD" style="width: 22%">${student.xb}</td>
				</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">班级：</td>
					<td class="table-contentTD" style="width: 22%">${student.bjmc}</td>
					<td class="table-titleTD" style="width: 12%">专业：</td>
					<td class="table-contentTD" style="width: 22%">${student.zymc}</td>
					<td class="table-titleTD" style="width: 12%">年级：</td>
					<td class="table-contentTD" style="width: 22%">${student.njmc}</td>
				</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">学期：</td>
					<td class="table-contentTD" style="width: 22%"><c:forEach items="${semesterList}"
							var="semester">
							<c:if test="${semesterSummary.semid==semester.xqid}">
					  ${semester.xqmc}
					  </c:if>
						</c:forEach></td>
					<td class="table-titleTD" style="width: 12%">政治面貌：</td>
					<td class="table-contentTD" style="width: 22%">${semesterSummary.zzmm==""? "无" :semesterSummary.zzmm}</td>
					<td class="table-titleTD" style="width: 12%">担任职务：</td>
					<td class="table-contentTD" style="width: 22%">${semesterSummary.drzw}</td>
				</tr>
				<tr>
					<td class="table-titleTD" colspan="6" style="text-align: left;">*本学期你想申请的先进项目：</td>
				</tr>
				<tr>
					<td colspan="6" class="table-contentTD" style="color: #000000">
						<c:choose>
							<c:when test="${not empty p1 && p1=='三好学生'}">
								<label><input type="radio" value="三好学生" 
									checked="checked" disabled="disabled" />三好学生</label>
							</c:when>
							<c:otherwise>
								<label><input type="radio" value="三好学生" 
								 disabled="disabled" />三好学生</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p2&& p2=='好学生'}">
								<label><input type="radio" value="好学生" 
									checked="checked" disabled="disabled" />好学生</label>
							</c:when>
							<c:otherwise>
								<label><input type="radio" value="好学生" 
									disabled="disabled" />好学生</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p3&& p3=='行为达标生'}">
								<label><input type="radio" value="行为达标生" 
									 checked="checked" disabled="disabled" />行为达标生</label>
							</c:when>
							<c:otherwise>
								<label><input type="radio" value="行为达标生" 
									 disabled="disabled" />行为达标生</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p21 && p21=='优秀班干部'}">
								<label><input type="checkbox" 
									value="优秀班干部" checked="checked" disabled="disabled" />优秀班干部</label>
							</c:when>
							<c:otherwise>
								<label><input type="checkbox" 
									value="优秀班干部" disabled="disabled" />优秀班干部</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p22&& p22=='技能特长生'}">
								<label><input type="checkbox"
									value="技能特长生" checked="checked" disabled="disabled" />技能特长生</label>
							</c:when>
							<c:otherwise>
								<label><input type="checkbox" 
									value="技能特长生" disabled="disabled" />技能特长生</label>
							</c:otherwise>
						</c:choose>
					</td>
				</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">本学期取得的各项荣誉：</td>
					<td colspan="5" class="table-contentTD"><textarea id="hdry"
							name="hdry" style="width: 90%; height: 80px;"
							placeholder="本学期取得的各项荣誉" disabled="disabled">${semesterSummary.hdry}</textarea>
					</td>
				</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">备注：</td>
					<td colspan="5" class="table-contentTD"><textarea id="remark"
							name="remark" style="width: 90%; height: 80px;" placeholder="备注"
							disabled="disabled">${semesterSummary.remark}</textarea></td>
				</tr>
			</table>
		</div>
		<div id="edit" style="display: none;">
			<table cellpadding="0" cellspacing="0" border="0"
				class="table-border" width="95%">
				<tr>
					<td class="table-header" colspan="6">期末总结信息</td>
				</tr>
			<tr>
				<td class="table-titleTD" style="width: 12%"><font color="red">*</font>姓名：</td>
				<td class="table-contentTD" style="width: 22%"><input type="text" id="xm" name="xm" value="${student.xm}" placeholder="请输入姓名"   autocomplete="off" readonly="readonly" class="inputText2 required"/>&nbsp;&nbsp;
				<input type="button" id="optionBtn" value="选择" class="inputButton"
					onclick="javascript:showStudentDiv();" readonly="readonly" />
				<input type="hidden" id="stuid" name="stuid" value="${semesterSummary.stuid}"/>
				</td>
				<td class="table-titleTD"  style="width: 12%">学号：</td>
				<td class="table-contentTD" style="width: 22%"><input type="text" id="xh" name="xh" value="${student.xh}" autocomplete="off" readonly="readonly" class="inputText"></td>
				<td class="table-titleTD" style="width: 12%">性别：</td>
				<td class="table-contentTD" style="width: 22%"><input type="text" id="xb" name="xb" value="${student.xb}"  autocomplete="off" readonly="readonly" class="inputText"></td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 12%">班级：</td>
				<td class="table-contentTD" style="width: 22%"><input type="text" value="${student.bjmc}" id="bjmc" name="bjmc" readonly="readonly" autocomplete="off" class="inputText" >
				<input type="hidden" id="bjid" name="bjid" value="${student.bjid}"/></td>
				<td class="table-titleTD" style="width: 12%">专业：</td>
				<td class="table-contentTD" style="width: 22%"><input type="text" value="${student.zymc}" id="zymc" name="zymc" readonly="readonly" autocomplete="off" class="inputText"></td>
				<td class="table-titleTD" style="width: 12%">年级：</td>
				<td class="table-contentTD" style="width: 22%"><input type="text" value="${student.njmc}" id="njmc" name="njmc" readonly="readonly" autocomplete="off" class="inputText"></td>
			</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">学期：</td>
					<td class="table-contentTD" style="width: 22%"><select id="semid" name="semid" class="selectList" placeholder="请选择学期">
							<option value="">请选择</option>
							<c:forEach items="${semesterList}" var="semester">
								<option value="${semester.xqid}">${semester.xqmc}</option>
							</c:forEach>
					</select></td>
					<td class="table-titleTD" style="width: 12%">政治面貌：</td>
					<td class="table-contentTD" style="width: 22%"><select id="zzmm" name="zzmm"
						 class="selectList" placeholder="请选择政治面貌">
							<option value="">无</option>
							<c:forEach items="${sysCodeList}" var="code">
								<option value="${code.codename}">${code.codename}</option>
							</c:forEach>
					</select></td>
					<td class="table-titleTD" style="width: 12%">担任职务：</td>
					<td class="table-contentTD" style="width: 22%" ><select id="drzw" name="drzw"
						 class="selectList" placeholder="请选择担任职务">
							<option value="">请选择</option>
							<option value="班长">班长</option>
							<option value="副班长">副班长</option>
							<option value="团支书">团支书</option>
							<option value="纪律委员">纪律委员</option>
							<option value="体育委员">体育委员</option>
							<option value="文艺委员">文艺委员</option>
							<option value="生活委员">生活委员</option>
							<option value="卫生委员">卫生委员</option>
							<option value="宣传委员">宣传委员</option>
							<option value="组织委员">组织委员</option>
							<option value="学习委员">学习委员</option>
							<option value="班主任助理">班主任助理</option>
							<option value="无">无</option>
					</select></td>
				</tr>
				<tr>
					<td class="table-titleTD" colspan="6" style="text-align: left;">*本学期你想申请的先进项目：</td>
				</tr>
				<tr>
					<td colspan="6" class="table-contentTD" style="color: #000000">
						<c:choose>
							<c:when test="${not empty p1&& p1=='三好学生'}">
								<label><input type="radio" value="三好学生" id="p"
									name="p1" checked="checked" onclick="optionRadion();" />三好学生</label>
							</c:when>
							<c:otherwise>
								<label><input type="radio" value="三好学生" id="p"
									name="p1" onclick="optionRadion();" />三好学生</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p2&& p2=='好学生'}">
								<label><input type="radio" value="好学生" id="p" name="p"
									checked="checked" onclick="optionRadion();" />好学生</label>
							</c:when>
							<c:otherwise>
								<label><input type="radio" value="好学生" id="p" name="p" onclick="optionRadion();"/>好学生</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p3&& p3=='行为达标生'}">
								<label><input type="radio" value="行为达标生" id="p"
									name="p" checked="checked" onclick="optionRadion();" />行为达标生</label>
							</c:when>
							<c:otherwise>
								<label><input type="radio" value="行为达标生" id="p"
									name="p" onclick="optionRadion();"/>行为达标生</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p21&& p21=='优秀班干部'}">
								<label><input type="checkbox" id="p21" name="p21"
									value="优秀班干部" checked="checked" />优秀班干部</label>
							</c:when>
							<c:otherwise>
								<label><input type="checkbox" id="p21" name="p21"
									value="优秀班干部" />优秀班干部</label>
							</c:otherwise>
						</c:choose> <c:choose>
							<c:when test="${not empty p22&& p22=='技能特长生'}">
								<label><input type="checkbox" id="p22" name="p22"
									value="技能特长生" checked="checked" />技能特长生</label>
							</c:when>
							<c:otherwise>
								<label><input type="checkbox" id="p22" name="p22"
									value="技能特长生" />技能特长生</label>
							</c:otherwise>
						</c:choose>
					</td>
				</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">本学期取得的各项荣誉：</td>
					<td colspan="5" class="table-contentTD"><textarea id="hdry"
							name="hdry" style="width: 90%; height: 80px;"
							placeholder="请输入本学期取得的各项荣誉">${semesterSummary.hdry}</textarea></td>
				</tr>
				<tr>
					<td class="table-titleTD" style="width: 12%">备注：</td>
					<td colspan="5" class="table-contentTD"><textarea id="remark"
							name="remark" style="width: 90%; height: 80px;" placeholder="请输入备注">${semesterSummary.remark}</textarea>
					</td>
				</tr>
			</table>
		</div>
		<br />
		<div id="button-view">
			<table cellpadding="1" cellspacing="1" border="0" align="left">
				<tr>
					<c:if test="${_login_user_type==2 and ismanager==1}">
					<kl:permission permisstionList="${permisstionList}" currentUser="${_login_console_user}" 
						currentCatalogId="<%=CatalogUtils.getCatalogId(\"XGGL_QMPB_QMZJ_BZR\")%>" key="modify">
					<td><input type="button" id="btnEdit" class="inputButton"
						style="text-align: center;" value="修改"
						onclick="javascript:gotoEditPage();" /></td>
 				   </kl:permission> 
				   </c:if>
					<td><input type="button" id="btnBack" class="inputButton"
						value="返回" style="text-align: center;" /></td>
				</tr>
			</table>
		</div>
		<div id="button-edit">
			<table cellpadding="1" cellspacing="1" border="0" align="left">
				<tr>
					<td><input type="button" id="btnSave" class="inputButton"
						style="text-align: center;" value="保存" autocomplete="off"  /></td>
					<td><input type="button" id="cancelSave" class="inputButton"
						style="text-align: center;" value="取消" autocomplete="off" 
						onclick="javascript:gotoViewPage();" /></td>
					<td><input type="button" id="btnBack2" autocomplete="off"  class="inputButton"
						value="返回" style="text-align: center;" /></td>
				</tr>
			</table>
		</div>
<div id="div1" style="display: none;">
			<table cellpadding="0" cellspacing="0" border="0" class="table-border">
				  <tr>
				  	 <td style="clear:both; width: 70%">
				  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"/><font color="green">在此查找</font> <br/>
				  	   <br/><label style="color:red;">未选中:</label><br/>
				  	   <select name="fromSelect" id="fromSelect" multiple="multiple"  size="1"  multiple="false" style="width:200px; height: 250px;"
							ondblclick="moveField('fromSelect','toSelect');">
											<c:forEach items="${studentList}" var="data">
									       <option value="${data.xsid}">${data.xm}</option>
								          </c:forEach>
						</select>
							<select name="sourseFromSelect2" id="sourseFromSelect2"   multiple="false" style="width: 220px; height: 150px; display: none;" >
										  <c:forEach items="${studentList}" var="data">
									       <option value="${data.xsid}">${data.xm}</option>
								          </c:forEach>
  	    </select>
						
					 </td>
  	              </tr>
			</table>
		</div>
	</form>
</body>
<script type="text/javascript">
	compareListValue(document.getElementById('semid'),
			'${semesterSummary.semid}');
	compareListValue(document.getElementById('zzmm'), '${semesterSummary.zzmm}');
	compareListValue(document.getElementById('drzw'), '${semesterSummary.drzw}');
	 if("${msg}"!=""){
	       layer.alert("${msg}", {icon: 6});
	  } 
</script>
</html>
